# TypeScript Proxy Generator

Project site: [tsproxy.codeplex.com](http://tsproxy.codeplex.com/)
Author: Kirsten Kluge

## Models

Every model in your API you want to have it in your TS Client must have the following attribute:

`[TSGen(TSGenTag.ClientModel)]`

In your client has to be a ".tt" (T4 Template) file with this content:

`<#@ include file="$(ProjectDir)TypeScriptProxyGenerator\ServerModels.ttinclude" #>`

The nane of this file will also the name for the generated ".ts" file.
For example: `ServerModels.tt` will result in `ServerModels.ts`

## Proxy

Controllers that should be available in your client must have the following attriute:

` [TSGen(TSGenTag.ServerProxy)]`

Every method in this controller will be generated in your client. You can ignore individual methods by adding the following attribute to them:

`[TSGen(TSGenTag.Ignore)]`

Place also a ".tt" where you want to have your proxy to be generated:
For the proxy there are 2 different generators:

### Anguar

This will generate a proxy to use with AngularJS without a dependency to jQuery

`<#@ include file="$(ProjectDir)TypeScriptProxyGenerator\ServerProxyAngular.ttinclude" #>`


### jQuery

This will generate a proxy to use with jQuery 

`<#@ include file="$(ProjectDir)TypeScriptProxyGenerator\ServerProxy.ttinclude" #>`

# Generate files

To generate the ".ts" files you can right click on the ".tt" file and select "Run custom tool".

You also can do: "BUILD" > "Transform all T4 Templates" an all Files in your solution will be generated.